﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

public partial class productlist : System.Web.UI.Page
{
    DataDB dataDB = new DataDB();
    private int _typeID;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            _typeID = Util.QueryStringHelper.GetQueryStringByInt("tID");
            _typeID = _typeID == -1 ? 1 : _typeID;

            UrunListele();
        }
    }

    private void UrunListele()
    {
        Util.Bindings.BindRepeater(dataDB.KategoriListesiGetir(_typeID), rpt1);
    }

    protected DataTable DatasourceGetir(object eval)
    {
        ViewState["UrunDt"] = dataDB.UrunListesiGetir(Convert.ToInt32(eval), _typeID);
        return ViewState["UrunDt"] as DataTable;
    }

    protected string ClassGetir(object eval)
    {
        if (Convert.ToInt32(eval) == 3)
            return " appr";
        else
            return string.Empty;
    }

    protected string DivGetir(object eval)
    {
        DataTable urunDt = ViewState["UrunDt"] as DataTable;
        DataRow urunDr = urunDt.Rows[urunDt.Rows.Count - 1];

        if (urunDr["SAYI"].ToString() == eval.ToString())
            return "<div class=\"clear\"></div>";
        else
            return string.Empty;
    }
}
